<template>
	<view class="msgpage">
		<view class="titleline">
			<view class="titlebox">
				<view class="iconfont icon-tixing-tianchong">
					
				</view>
				<view class="titlename">
					随访消息
				</view>
			</view>
		
		</view>
		<view class="gongzhongbox">
			
			<view class="msgline" @click="suifangshijianzhou">
				<view class="iconfont icon-rili2">
					
				</view>
				<view class="lebelbox">
					<view class="label">
						随访提醒
					</view>
					<view class="time">
						本周
					</view>
				</view>
				<view class="type">
					2025-09-28 10:08:25
				</view>
				
			</view>
			<view class="msgline" @click="even">
				<view class="iconfont icon-rili2">
					
				</view>
				<view class="lebelbox">
					<view class="label">
						事件提醒
					</view>
					<view class="time">
						本周
					</view>
				</view>
				
				<view class="type">
					2025-09-28 10:10:25
				</view>
			</view>
			
		</view>
		<view class="titleline">
			<view class="titlebox">
				<view class="iconfont icon-xiaoxi2">
					
				</view>
				<view class="titlename">
					团队消息
				</view>
			</view>
		
		</view>
		<view class="listbox">
			<view class="title" v-if="list.length==0">
				暂无团队
			</view>
			<view class="itemlist" v-for="item in list" :key="item.teamId" @click="gotalk(item)">
				<view class="imgbox">
					<view class="num" v-if="item.lastMessage.unreadCount!=0">
						{{item.lastMessage.unreadCount}}
					</view>
					<image src="https://changban.dianjingkeji.net/img/微信图片_20230817153730.jpg" ></image>
				</view>
				<view class="infobox">
					<view class="infoname">
						{{item.teamName}}
					</view>
					<view class="content">
						{{item.lastMessage.lastMessageContent}}
					</view>
				</view>
				<view class="time">
					{{item.lastMessage.lastMessageTime}}
				</view>
			</view>
		</view>
		
		
		
		

	</view>
</template>

<script>
	import {getUnreadSummaryByDoctor,getInfo} from '../../utils/api.js'
	export default {
		data() {
			return {
				user:'',
				list:[]
			}
		},
		onShow() {
			console.log(this.user)
			let p={
				phone:uni.getStorageSync('phone')
			}
			getInfo(p).then(res=>{
				if(res.data.code==200){
					
					this.user=res.data.data.info
					if(res.data.data.info.memberLevel==3){
						let a={
							phone:uni.getStorageSync('phone')
						}
						getUnreadSummaryByDoctor(a).then(res=>{
							console.log(res,'这是未读消息列表')
							this.list=res.data.data
						})
					}
				}
				
			})
			
		},
		
		methods: {

			gotalk(e){
				let id=e.teamId
				let name=e.teamName
				uni.navigateTo({
					url:'/pagesA/talk/talk?id='+id+'&name='+name
				})
			},
			suifangshijianzhou(){
				uni.showToast({
					title: '敬请期待',
					icon:'none',
					duration: 2000
				});
				// uni.navigateTo({
				// 	url:'/pagesB/plan/plan'
				// })
			},
			even(){
				uni.showToast({
					title: '敬请期待',
					icon:'none',
					duration: 2000
				});
				// uni.navigateTo({
				// 	url:'/pagesB/remind/remind'
				// })
			},
		}
	}
</script>

<style lang="less" scoped>
	.msgpage{
		width: 750rpx;
		background-color: whitesmoke;
        box-sizing: border-box;
		padding: 20rpx 20rpx 150rpx 20rpx;
		
		
		.titleline{
			
			display: flex;
			align-items: center;
			justify-content: space-between;
			color: #1a4f8a;
			box-sizing: border-box;
			margin: 20rpx;
			.titlebox{
				display: flex;
				align-items: center;
				font-size: 38rpx;
				font-weight: bold;
				.iconfont{
					font-size: 50rpx;
					margin-right: 20rpx;
				}
			}
			.lookmore{
				font-weight: bold;
			}
			
		}
		.gongzhongbox{
			width: 100%;
			box-sizing: border-box;
			border-radius: 20rpx;
			padding: 20rpx;
			background-color: white;
			box-shadow: 0 0 10rpx rgba(0,0,0,0.1); /* x偏移 y偏移 模糊 半径 颜色 */
			.msgline{
				display: flex;
				width: 100%;
				align-items: center;
			    justify-content: space-between;
				margin-bottom: 16rpx;
				padding: 20rpx  8rpx;
				.iconfont{
					font-size: 46rpx;
					color: #c3c3c3;
				}
				.lebelbox{
					width: 60%;
				
					.label{
						font-weight: bold;
						font-size: 36rpx;
					}
				}
				.type{
					
					color: gray;
					
					font-weight: bold;
					font-size: 26rpx;
				}
				.type1{
					padding: 4rpx 24rpx;
					color: white;
					border-radius: 26rpx;
					background-color:#00A3FF;
					line-height: 44rpx;
					text-align: center;
					font-weight: bold;
					font-size: 26rpx;
				}
			}
		}
		.listbox{
			width: 100%;
			box-sizing: border-box;
			border-radius: 20rpx;
			padding: 20rpx;
			background-color: white;
			box-shadow: 0 0 10rpx rgba(0,0,0,0.1); /* x偏移 y偏移 模糊 半径 颜色 */
			.title{
				color: gray;
				text-align: center;
				margin-top: 30rpx;
			}
			.itemlist{
				display: flex;
				width: 100%;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 16rpx;
				padding: 20rpx  8rpx;
				.imgbox{
					width: 100rpx;
					height: 100rpx;
					border-radius: 50%;
					position: relative;
					.num{
												   position: absolute;
												   color: red;
												   border-radius: 50%;
												   font-size: 22rpx;
												   font-weight: bold;
												   top: 0;
												   right: -10rpx;
												  
					}
					image{
						width: 100%;
						height: 100%;
						border-radius: 50%;
					}
				}
				.infobox{
					width: 50%;
					.infoname{
						font-weight: bold;
						font-size: 36rpx;
					}
					.content{
						width: 100%;
						  white-space: nowrap;        /* 强制不换行 */
						  overflow: hidden;           /* 超出隐藏 */
						  text-overflow: ellipsis;    /* 溢出用省略号替代 */
						  display: inline-block;      /* 或者 block/flex */
						  max-width: 200px;    
								 font-size: 26rpx;/* 必须要有宽度限制 */
								 font-weight: bold;
								 color: gray;
					}
					
				}
				.time{
					font-size: 28rpx;/* 必须要有宽度限制 */
					font-weight: bold;
				}
			}
		}
		
		
		
		
		
		
		
	}

</style>
